import pandas as pd
import numpy as np
import tushare as ts

filename = "E:\\quant\\2025-03-14\\000009.csv"
data = pd.read_csv(filename,encoding='gbk',dtype=str)

volume = data['Volume'].to_numpy().astype(float)
dealtype = data['Type'].to_numpy()
prices = data['Price'].to_numpy().astype(float)
times = data["Time"].to_numpy()

bigsel = 0
bigbuy = 0

pro = ts.pro_api()
df = pro.daily_basic(ts_code='000759.SZ', trade_date='20250227', fields='ts_code,total_share')
flow = df.loc[0,'total_share']
for i in range(len(volume)):
    if volume[i] > 30000:
        if dealtype[i] == 'S':
            bigsel += volume[i]
        elif dealtype[i] == 'B':
            bigbuy += volume[i]
    if (bigsel-bigbuy)/flow > 0.01:
        print("buy at price%f, time:%s"%(prices[i],times[i]))

print("bigdealnet:%f"%((bigsel-bigbuy)/flow))